package com.jz.pay.service.impl;

import com.jz.commom.api.dto.request.Payment;
import com.jz.pay.bo.PaymentBO;
import com.jz.pay.dao.PaymentDao;
import com.jz.pay.service.PaymentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Api
@ApiModel(value = "支付接口")
@Service
public class PaymentServiceImpl implements PaymentService {

    @Resource
    private PaymentDao paymentDao;

    @Resource
    private PaymentBO paymentBO;

    @ApiOperation(value = "创建订单")
    public int create(Payment payment){
        return paymentDao.create(payment);
    }

    /**
     * 分表后api
     * @param payment
     * @return
     */
    @ApiOperation(value = "创建订单")
    public int createNew(Payment payment){
        return paymentBO.createNew(payment);
    }

    @ApiOperation(value = "查询订单")
    public List<Payment> query(Payment payment){
        return paymentBO.query(payment);
    }

    @ApiOperation(value = "根据ID查询订单")
    public Payment getPaymentById(Long id){
        return paymentDao.getPaymentById(id);
    }
}
